package com.ics.framework.web.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author shaoly
 * @description 基础类
 * @ClassName BaseEntity.java
 * @createTime 2023年06月13日 16:46:38
 */
@Data
public class BaseDo extends Model implements Serializable {

    @JsonSerialize(
            using = ToStringSerializer.class
    )
    @ApiModelProperty("主键id")
    @TableId(
            value = "id",
            type = IdType.ASSIGN_ID
    )
    private Long id;

    @ApiModelProperty("创建人")
    @TableField(
            value = "create_by",
            fill = FieldFill.INSERT
    )
    private String createBy;

    @ApiModelProperty("创建时间")
    @TableField(
            value = "create_time",
            fill = FieldFill.INSERT
    )
    @JsonFormat(
            shape = JsonFormat.Shape.STRING,
            pattern = "yyyy-MM-dd HH:mm:ss"
    )
    private LocalDateTime createTime;

    @ApiModelProperty("更新人")
    @TableField(
            value = "update_by",
            fill = FieldFill.INSERT_UPDATE
    )
    private String updateBy;

    @ApiModelProperty("更新时间")
    @TableField(
            value = "update_time",
            fill = FieldFill.INSERT_UPDATE
    )
    @JsonFormat(
            shape = JsonFormat.Shape.STRING,
            pattern = "yyyy-MM-dd HH:mm:ss"
    )
    private LocalDateTime updateTime;

    @ApiModelProperty("是否已删除")
    @TableLogic
    private String status;
}
